package cn.hl.sfzy.controller;

import cn.hl.sfzy.entity.CourseMark;
import cn.hl.sfzy.entity.CourseTalk;
import cn.hl.sfzy.service.CourseMarkService;
import cn.hl.sfzy.service.CourseTalkService;
import cn.hl.sfzy.util.Result;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName CourseTalkController
 * @Description TODO
 * @Author libowen
 * @Date 2024年10月29日 10:22
 * @Version 1.0
 */
@RestController
@RequestMapping("/CourseTalk")
@CrossOrigin
public class CourseTalkController {

    @Autowired
    private CourseTalkService courseTalkService;

    @GetMapping("/findByCourseId")
    public Result selectByCourseId(@RequestParam(required = false,defaultValue = "1") int pageNum, @RequestParam(required = false,defaultValue = "5") int pageSize, Long course_id) {
        PageInfo<CourseTalk> courseTalks = courseTalkService.findByCourseId(pageNum,pageSize,course_id);
        return Result.success(courseTalks);
    }

    @GetMapping("/findByCourseIdOrder1")
    public Result selectByCourseIdOrder1(Long course_id) {
        List<CourseTalk> courseTalks = courseTalkService.findByCourseIdOrder1(course_id);
        return Result.success(courseTalks);
    }

    @GetMapping("/findByCourseIdOrder2")
    public Result selectByCourseIdOrder2(Long course_id) {
        List<CourseTalk> courseTalks = courseTalkService.findByCourseIdOrder2(course_id);
        return Result.success(courseTalks);
    }



}
